﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:conv="clr-namespace:WindSim.Converter"
                    xmlns:Dashboarding="clr-namespace:Codeplex.Dashboarding;assembly=Codeplex.Dashboarding" >
    <!--Converter-->
    <conv:PowerStateToBoolConverter x:Key="PowerToBoolConverter" />
    <conv:PowerStateToIntConverter x:Key="PowerToIntConverter" />
    <conv:FunctionStateToFunctionButtonTextConverter x:Key="FunctionToButtonTextConverter" />
    <conv:FunctionStateToBoolConverter x:Key="FunctionToBoolConverter" />
    <conv:DisableEnableControlsConverter x:Key="EnableControlsConverter" />
    <conv:DisableEnableFunctionstateButtonConverter x:Key="EnableFunctionstateButtonConverter" />
    <conv:EnumToBooleanConverter x:Key="EnumToBoolConverter" />
    <conv:DegreeToCompassDirectionConverter x:Key="DegreeToCompassDirectionConverter" />
    <conv:DayTimeToAxisAngleRotation3DConverter x:Key="DayTimeToAxisAngleRotation3DConverter"/>
    <conv:WindSpeedToStringConverter x:Key="WindSpeedToStringConverter"/>
    <conv:RPMToStringConverter x:Key="RPMToStringConverter"/>
    <conv:PowerToStringConverter x:Key="PowerToStringConverter"/>
    <conv:PowerToDashboardValueConverter x:Key="PowerToDashboardValueConverter"/>
    <conv:IsConnectedToVisibleOrCollapsedConverter x:Key="IsConnectedToVisibleOrCollapsedConverter"/>
    <conv:ShowRetryServiceSearchButtonConverter x:Key="ShowRetryServiceSearchButtonConverter" />
    
    <!--Datatemplate - lbConnectedClients-->
    <DataTemplate x:Key="ClientDataTemplate">
        <StackPanel Orientation="Vertical">
            <TextBlock Text="{Binding Value.Name}"/>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text=" ("/>
                <TextBlock Text="{Binding Value.ControlType}"/>
                <TextBlock Text=")"/>                
            </StackPanel>
        </StackPanel>
    </DataTemplate>

    <!-- ConnectedModels ListBoxItem Style -->
    <DataTemplate x:Key="NormalConnectedModelsItemTemplate">
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Value.Name}" FontWeight="Bold"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Standort: "/>
                <TextBlock Text="{Binding Value.Location}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Steuerung: "/>
                <TextBlock Text="{Binding Value.ControlType}"/>
            </StackPanel>
        </StackPanel>
    </DataTemplate>

    <Style x:Key="ConnectedModelsItemContainer" TargetType="{x:Type ListBoxItem}">
        <Setter Property="ContentTemplate" Value="{StaticResource NormalConnectedModelsItemTemplate}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border CornerRadius="5" BorderThickness="1" x:Name="IconBorder" Margin="4,4,4,0" Background="{x:Null}" Padding="2" >
                        <ContentPresenter Margin="0"  />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="IconBorder" Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="#FFD6E4F3" />
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="IconBorder" Property="BorderBrush">
                                <Setter.Value>
                                    <SolidColorBrush Color="#FFB9C9DA" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="ContentTemplate" Value="{StaticResource NormalConnectedModelsItemTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--Style - PowerLED-->
    <Style x:Key="PowerLedStyle" TargetType="{x:Type Dashboarding:RoundLed}">
        <Setter Property="TrueColor">
            <Setter.Value>
                <Dashboarding:ColorPoint HiColor="#FF589C11" LowColor="Beige" Value="9"/>
            </Setter.Value>
        </Setter>
        <Setter Property="FalseColor">
            <Setter.Value>
                <Dashboarding:ColorPoint HiColor="Gray" LowColor="AntiqueWhite" Value="9"/>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--Style - FunctionLED-->
    <Style x:Key="FunctionstateLEDStyle" TargetType="{x:Type Dashboarding:RoundLed}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsTrue}" Value="true">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation From="0.5" To="1.0" Duration="00:00:00.5" Storyboard.TargetProperty="Opacity" RepeatBehavior="Forever" AutoReverse="True"/>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
                <DataTrigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation From="0.5" To="1.0" Duration="00:00:00.5" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.ExitActions>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <BorderGapMaskConverter x:Key="BorderGapMaskConverter" />
    <Style TargetType="{x:Type GroupBox}">
        <Setter Property="BorderBrush" Value="#D5DFE5" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="6" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="6" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="6" />
                        </Grid.RowDefinitions>
                        <Border Grid.ColumnSpan="4" Grid.RowSpan="4" Background="{DynamicResource LightBrush}" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" />
                        <Border Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" BorderThickness="1,1,1,1" CornerRadius="4" BorderBrush="{DynamicResource NormalBorderBrush}">
                            <Border.OpacityMask>
                                <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7">
                                    <Binding Path="ActualWidth" ElementName="Header" />
                                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
                                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
                                </MultiBinding>
                            </Border.OpacityMask>
                            <Border BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                                <Border.BorderBrush>
                                    <SolidColorBrush Color="{DynamicResource MainColor}" />
                                </Border.BorderBrush>
                                <Border BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
                                    <Border.BorderBrush>
                                        <SolidColorBrush Color="{DynamicResource MainColor}" />
                                    </Border.BorderBrush>
                                </Border>
                            </Border>
                        </Border>
                        <Border Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" />
                        <Border Grid.ColumnSpan="4" Grid.RowSpan="2" Background="{DynamicResource NormalBrush}" BorderThickness="1,1,1,0" CornerRadius="2,2,0,0" x:Name="Main" BorderBrush="{DynamicResource NormalBorderBrush}" />
                        <Rectangle Opacity="1" Stroke="{x:Null}" RadiusX="3" RadiusY="3" VerticalAlignment="Stretch" Height="Auto" x:Name="Shine" Grid.ColumnSpan="4" Grid.RowSpan="2" Margin="1,1,1,1">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,0.971" StartPoint="0.5,0.042">
                                    <GradientStop Color="#26FFFFFF" Offset="0" />
                                    <GradientStop Color="#00FFFFFF" Offset="1" />
                                    <GradientStop Color="#26FFFFFF" Offset="0.467" />
                                    <GradientStop Color="#00FFFFFF" Offset="0.475" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>

                        <Border x:Name="Header" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Padding="3,1,3,0">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" Margin="0,4,0,4" />
                        </Border>

                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground">
            <Setter.Value>
                <SolidColorBrush Color="{DynamicResource WhiteColor}" />
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>